import React from 'react';
import { observer, inject } from 'mobx-react';
import {toJS} from 'mobx';
import '../../style/continuationProcess.less';
import { WeaLocaleProvider } from 'ecCom';
import allStore from '../../stores';
const getLabel = WeaLocaleProvider.getLabel;

@inject("continnuationProcessStore")
@observer
export default  class Main extends React.Component {

  constructor(){
    super();
  }

  componentDidMount(){
    const {continnuationProcessStore, location = {}} = this.props;
    const {requestUrl, initContinnuationProcessInfo, showRequestPage} = continnuationProcessStore;
    const {currentRequestid} = location.query;
    initContinnuationProcessInfo({currentRequestId : currentRequestid});
  }

    render(){
      const {continnuationProcessStore} = this.props;
      const {currentIndex, counts, requestIds, switchRequest, requestPageLoaded} = continnuationProcessStore;
      let spanLabel = getLabel(517273, "第{current}条（共{counts}条）");
      spanLabel = spanLabel.replace(/{current}/, currentIndex + 1);
      spanLabel = spanLabel.replace(/{counts}/, counts);
      return (
        <div className='wf-continuationProcess-div'>
            <div className="wf-continuationProcess-title">
            <span>{spanLabel}</span>
              <div className="wf-continuationProcess-title-pageSwitch">
                <span className={(currentIndex != 0 && requestPageLoaded) ? "prePage" : "pre-disabled"} onClick={() => {switchRequest('pre')}}>{getLabel(515115, "上一条")}</span>
                <span className={(currentIndex != counts - 1 && requestPageLoaded) ? "nextPage" : "disabled"} onClick={() => {switchRequest('next')}}>{getLabel(515116, "下一条")}</span>
              </div>
            </div>
            <iframe
              className='wf-continuationProcess-title-formIframe'
              id="formIframe"
              // src={""}
            />
        </div>
      )
    }
    

  }
